<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // repalace('正则',字符串/函数('匹配成功的字符串,原子组,偏移量,原字符串')))
      //exec
      //matchAll
      // match

      // search  返回正则匹配成功的第一个索引
      const paragraph = "I think Ruth's dog is cuter than your dog!";
      // Anything not a word character, whitespace or apostrophe
      const regex = /[^\w\s']/g;

      console.log(paragraph.match(regex));//!
      console.log(paragraph.search(regex));
      // Expected output: 41

      console.log(paragraph[paragraph.search(regex)]);
      // Expected output: "!"
    </script>
  </body>
</html>
